# encoding=utf8
import os

from flask import Blueprint, current_app, send_from_directory

__all__ = [
    'bp'
]

bp = Blueprint('common', __name__)


@bp.route('/favicon.ico')
def get_fav():
    t_d = current_app.template_folder
    t_d = os.path.dirname(t_d)
    t_d = os.path.join(t_d, "static")
    t_d = os.path.abspath(t_d)
    f_n = 'favicon.ico'
    # 它在模板目录
    return send_from_directory(t_d, f_n, cache_timeout=100, mimetype='image/vnd.microsoft.icon')
